#pragma once
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<algorithm>
#include<unordered_map>
#include<set>
#include "myGraph.hpp"
using namespace std;
void rotate(vector<vector<int>>& matrix) {
    int n = matrix.size();
    if (n <= 1) { return; }
    int m = (n & 1 == 1) ? n / 2 - 1 : n / 2;
    int tem;
    for (int i = 0; i <= m; i++) {
        int r = i, c = n - i - 1;
        for (int j = 0; j < n - 2 * i; ++j) {
            tem = matrix[i][n - i - 1];
            for (; c > 0; --c) {
                matrix[r][c] = matrix[r][c - 1];
            }
            for (; r < n - i - 1; ++r) {
                matrix[r][c] = matrix[r + 1][c];
            }
            for (; c < n - i - 1; ++c) {
                matrix[r][c] = matrix[r][c + 1];
            }
            for (; r > 0; --r) {
                matrix[r][c] = matrix[r - 1][c];

            }
            matrix[i + 1][n - i - 1] = tem;
        }
    }
}
int main() {
    vector<vector<int>> Am = { {1,2,3} ,{4,5,6},{7,8,9} };
    rotate(Am);
}
